package com.example.springboottestservice.cycle;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;

@Component
public class CycleB {

    //属性注入，能解决
    public CycleB(){
        System.out.println("初始化B");
    }

    @Autowired
    private CycleA cycleA;

    public void test(){
        System.out.println("执行test");
    }

    //构造方法，不能解决
//    public CycleB(CycleA cycleA){
//        System.out.println("初始化B");
//    }
//
//    private CycleA cycleA;

//    public CycleB(){
//        System.out.println("初始化B");
//    }
//
//    @Autowired
//    private CycleA cycleA;
//
//    @Async
//    public void test(){
//        cycleA.test();
//    }

}
